﻿
using System.Collections.Generic;

namespace LxCFD
{
    public class SIMPLEGroup : SolvableUnitGroup<SIMPLEBase>
    {
        public List<PressureCorrectionBasic> SIMPLEs = new List<PressureCorrectionBasic>();
        public List<ConnectBase> Connects = new List<ConnectBase>();
        public override void Rearrange(ConnectivityAnalysis connectivityAnalysis)
        {
            Units = new List<SIMPLEBase>();
            var list = connectivityAnalysis.SplitByConnectivity(SIMPLEs, Connects);
            foreach (var l in list)
            {
                SIMPLEBase u;//= new SIMPLEBaseUnit();
                if (l.Zones[0].SIMPLEMethod == SIMPLEMethods.PISO)
                {
                    u = new PISOUnit();
                }
                else
                {
                    u = new SIMPLEUnit();
                }
                u.CreateUnit(l.Zones, l.Contacts, SolverType);
                Units.Add(u);
            }
            SIMPLEs.Clear();
            Connects.Clear();
        }

    }
}
// public SIMPLEBaseUnit TempStor { get; set; }
//public override void Clear()
//{
//    base.Clear();
//    TempStor = new SIMPLEBaseUnit();
//}